package com.jsjosem.aftersales.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.jsjosem.aftersales.R;
import com.jsjosem.aftersales.data.response.CityResponse;

import java.util.List;

public class CountyAdapter extends ArrayAdapter<CityResponse> {
    public CountyAdapter(@NonNull Context context, int resource, @NonNull List<CityResponse> objects) {
        super(context, resource, objects);
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        CityResponse counties = getItem(position);
        @SuppressLint("ViewHolder") View view = LayoutInflater.from(getContext()).inflate(R.layout.customer_address_item_list, parent, false);

        TextView areaItem = view.findViewById(R.id.area_item);
        areaItem.setText(counties.getName());

        return view;
    }
}
